/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package action;

import dao.TransaksiDAO;
import dao.mysql.TransaksiDAOImpl;
import javax.servlet.http.HttpServletRequest;
import utility.DBConnection;

/**
 *
 * @author Student
 */
public class InvoiceListAction implements Action{

    @Override
    public String execute(HttpServletRequest request) {
        DBConnection db = new DBConnection();
        TransaksiDAO dao = new TransaksiDAOImpl(db.getConnection());
        String out = "";
        try{
            request.setAttribute("invoices", dao.getAll());
            out = "invoice_list.jsp";
        }catch(Exception ex){
            out = "errors.jsp";
            request.setAttribute("message", ex.getMessage());
        }
        return out;
    }
    
}
